import request from "@/plugins/request/request_dic";
let pre = "/support/menu";

// 查询首页应用
export function queryAppHomeMenu() {
  let staffId = "";
  if (sessionStorage.getItem("userInfo")) {
    staffId = JSON.parse(sessionStorage.getItem("userInfo")).user;
  }
  return request({
    url: `${pre}/queryAppHomeMenu`,
    method: "post",
    data: { staffId },
  });
}

// 查询用户菜单
export function queryStaffMenu() {
  let staffId = "";
  if (sessionStorage.getItem("userInfo")) {
    staffId = JSON.parse(sessionStorage.getItem("userInfo")).user;
  }
  return request({
    url: `${pre}/queryStaffMenu`,
    method: "post",
    data: {
      staffId,
      terminalType: '2'
    }
  });
}

// 保存首页应用
export function addAppHomeMenu(data) {
  return request({
    url: `${pre}/addAppHomeMenu`,
    method: "post",
    data,
  });
}

// 首页轮播图
export function queryRotationApp() {
  return request({
    url: `/support/rotationApp/queryRotationApp`,
    method: "post",
  });
}

// 获取版本信息
export function queryConfig() {
  return request({
    url: `/support/assist/queryConfig`,
    method: "post",
  });
}

// App首页块
export function queryBlockMenuApp() {
  return request({
    url: `/support/rotationApp/queryBlockMenuApp`,
    method: "get",
  });
}

// 保存菜单访问日志
export function saveBusiAccesslog(data) {
  return request({
    url: `/log/busi-accesslog/save`,
    method: "post",
    headers: {
      terminalType: '2'
    },
    data,
  });
}
